<template>
	<view class="p-h24 p-v20">
		<view class="p-v20">
			<text class="text-700-130">共 {{ list.length }} 条</text>
		</view>
		<view class="bg-1 p-h20 list">
			<view v-if="list.length === 0" class="p-v80">
				<up-empty mode="list" />
			</view>
			<template v-else>
				<view
					v-for="item in list"
					:key="item.id"
					class="flex p-v20 item"
					@click="gotoUrl(item.id)"
				>
					<image class="img" :src="item.avatar" mode="aspectFill" />
					<view class="m-l20 flex-1">
						<view class="flex-sb">
							<text class="text-700-132">{{ item.nickname }}</text>
							<!-- <text v-if="item.job.length > 0" class="text-700-532">{{ item.job[0].position }}</text> -->
						</view>
						<view class="flex-sb m-t10">
							<text class="text-400-326"
								>{{ item.gender == 1 ? "男" : "女" }} |
								{{ item.highest_education }} |
								{{
									item.work > 0
										? `${getWorkTimesLabel(item.work)}工作经验`
										: "无经验"
								}}</text
							>
							<text class="text-400-326">{{ item.time }}</text>
						</view>
					</view>
				</view>
			</template>
		</view>
	</view>
</template>

<script lang="ts" setup>
import type { TResume } from "@/types/api.d";
import { genStaticUrl } from "@/utils/utils";
import { ref } from "vue";
import { useCommonStore } from "@/stores/user";
const { getWorkTimesLabel } = useCommonStore();
function gotoUrl(id: number) {
	uni.navigateTo({ url: `/pages/office/resume/resume?user_id=${id}` });
}
const list = ref([]);
async function getList() {
	const res = await uni.$u.get<TResume[]>("/resume/sclst");
	list.value = res.data;
}
getList();
</script>

<style lang="scss">
page {
	background-color: $page-color-4;
}
</style>

<style lang="scss" scoped>
.list {
	border-radius: 10rpx;
}

.item {
	position: relative;

	.img {
		width: 107rpx;
		height: 107rpx;
		border-radius: 10rpx;
	}
}

.item + .item {
	&::before {
		@include hairline-top;
	}
}
</style>
